<?php

namespace GotchaDatabase\om;

use \Criteria;
use \Exception;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelCollection;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use GotchaDatabase\GotchaUsers;
use GotchaDatabase\JasminumNews;
use GotchaDatabase\JasminumNewsLinks;
use GotchaDatabase\JasminumNewsPeer;
use GotchaDatabase\JasminumNewsQuery;

/**
 * Base class that represents a query for the 'Jasminum_News' table.
 *
 *
 *
 * @method JasminumNewsQuery orderById($order = Criteria::ASC) Order by the Id column
 * @method JasminumNewsQuery orderByTitle($order = Criteria::ASC) Order by the Title column
 * @method JasminumNewsQuery orderByBody($order = Criteria::ASC) Order by the Body column
 * @method JasminumNewsQuery orderByCreationDate($order = Criteria::ASC) Order by the Creation_Date column
 * @method JasminumNewsQuery orderByCreationTime($order = Criteria::ASC) Order by the Creation_Time column
 * @method JasminumNewsQuery orderByGotchaUsersId($order = Criteria::ASC) Order by the Gotcha_Users_Id column
 * @method JasminumNewsQuery orderByThumbnail($order = Criteria::ASC) Order by the Thumbnail column
 *
 * @method JasminumNewsQuery groupById() Group by the Id column
 * @method JasminumNewsQuery groupByTitle() Group by the Title column
 * @method JasminumNewsQuery groupByBody() Group by the Body column
 * @method JasminumNewsQuery groupByCreationDate() Group by the Creation_Date column
 * @method JasminumNewsQuery groupByCreationTime() Group by the Creation_Time column
 * @method JasminumNewsQuery groupByGotchaUsersId() Group by the Gotcha_Users_Id column
 * @method JasminumNewsQuery groupByThumbnail() Group by the Thumbnail column
 *
 * @method JasminumNewsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method JasminumNewsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method JasminumNewsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method JasminumNewsQuery leftJoinGotchaUsers($relationAlias = null) Adds a LEFT JOIN clause to the query using the GotchaUsers relation
 * @method JasminumNewsQuery rightJoinGotchaUsers($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GotchaUsers relation
 * @method JasminumNewsQuery innerJoinGotchaUsers($relationAlias = null) Adds a INNER JOIN clause to the query using the GotchaUsers relation
 *
 * @method JasminumNewsQuery leftJoinJasminumNewsLinks($relationAlias = null) Adds a LEFT JOIN clause to the query using the JasminumNewsLinks relation
 * @method JasminumNewsQuery rightJoinJasminumNewsLinks($relationAlias = null) Adds a RIGHT JOIN clause to the query using the JasminumNewsLinks relation
 * @method JasminumNewsQuery innerJoinJasminumNewsLinks($relationAlias = null) Adds a INNER JOIN clause to the query using the JasminumNewsLinks relation
 *
 * @method JasminumNews findOne(PropelPDO $con = null) Return the first JasminumNews matching the query
 * @method JasminumNews findOneOrCreate(PropelPDO $con = null) Return the first JasminumNews matching the query, or a new JasminumNews object populated from the query conditions when no match is found
 *
 * @method JasminumNews findOneByTitle(string $Title) Return the first JasminumNews filtered by the Title column
 * @method JasminumNews findOneByBody(string $Body) Return the first JasminumNews filtered by the Body column
 * @method JasminumNews findOneByCreationDate(string $Creation_Date) Return the first JasminumNews filtered by the Creation_Date column
 * @method JasminumNews findOneByCreationTime(string $Creation_Time) Return the first JasminumNews filtered by the Creation_Time column
 * @method JasminumNews findOneByGotchaUsersId(int $Gotcha_Users_Id) Return the first JasminumNews filtered by the Gotcha_Users_Id column
 * @method JasminumNews findOneByThumbnail(string $Thumbnail) Return the first JasminumNews filtered by the Thumbnail column
 *
 * @method array findById(int $Id) Return JasminumNews objects filtered by the Id column
 * @method array findByTitle(string $Title) Return JasminumNews objects filtered by the Title column
 * @method array findByBody(string $Body) Return JasminumNews objects filtered by the Body column
 * @method array findByCreationDate(string $Creation_Date) Return JasminumNews objects filtered by the Creation_Date column
 * @method array findByCreationTime(string $Creation_Time) Return JasminumNews objects filtered by the Creation_Time column
 * @method array findByGotchaUsersId(int $Gotcha_Users_Id) Return JasminumNews objects filtered by the Gotcha_Users_Id column
 * @method array findByThumbnail(string $Thumbnail) Return JasminumNews objects filtered by the Thumbnail column
 *
 * @package    propel.generator.gotcha.om
 */
abstract class BaseJasminumNewsQuery extends ModelCriteria
{
    /**
     * Initializes internal state of BaseJasminumNewsQuery object.
     *
     * @param     string $dbName The dabase name
     * @param     string $modelName The phpName of a model, e.g. 'Book'
     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     */
    public function __construct($dbName = 'codenova_jasminum', $modelName = 'GotchaDatabase\\JasminumNews', $modelAlias = null)
    {
        parent::__construct($dbName, $modelName, $modelAlias);
    }

    /**
     * Returns a new JasminumNewsQuery object.
     *
     * @param     string $modelAlias The alias of a model in the query
     * @param   JasminumNewsQuery|Criteria $criteria Optional Criteria to build the query from
     *
     * @return JasminumNewsQuery
     */
    public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof JasminumNewsQuery) {
            return $criteria;
        }
        $query = new JasminumNewsQuery();
        if (null !== $modelAlias) {
            $query->setModelAlias($modelAlias);
        }
        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }

    /**
     * Find object by primary key.
     * Propel uses the instance pool to skip the database if the object exists.
     * Go fast if the query is untouched.
     *
     * <code>
     * $obj  = $c->findPk(12, $con);
     * </code>
     *
     * @param mixed $key Primary key to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return   JasminumNews|JasminumNews[]|mixed the result, formatted by the current formatter
     */
    public function findPk($key, $con = null)
    {
        if ($key === null) {
            return null;
        }
        if ((null !== ($obj = JasminumNewsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
            // the object is already in the instance pool
            return $obj;
        }
        if ($con === null) {
            $con = Propel::getConnection(JasminumNewsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        if ($this->formatter || $this->modelAlias || $this->with || $this->select
         || $this->selectColumns || $this->asColumns || $this->selectModifiers
         || $this->map || $this->having || $this->joins) {
            return $this->findPkComplex($key, $con);
        } else {
            return $this->findPkSimple($key, $con);
        }
    }

    /**
     * Alias of findPk to use instance pooling
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return                 JasminumNews A model object, or null if the key is not found
     * @throws PropelException
     */
     public function findOneById($key, $con = null)
     {
        return $this->findPk($key, $con);
     }

    /**
     * Find object by primary key using raw SQL to go fast.
     * Bypass doSelect() and the object formatter by using generated code.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return                 JasminumNews A model object, or null if the key is not found
     * @throws PropelException
     */
    protected function findPkSimple($key, $con)
    {
        $sql = 'SELECT `Id`, `Title`, `Body`, `Creation_Date`, `Creation_Time`, `Gotcha_Users_Id`, `Thumbnail` FROM `Jasminum_News` WHERE `Id` = :p0';
        try {
            $stmt = $con->prepare($sql);
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
        }
        $obj = null;
        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $obj = new JasminumNews();
            $obj->hydrate($row);
            JasminumNewsPeer::addInstanceToPool($obj, (string) $key);
        }
        $stmt->closeCursor();

        return $obj;
    }

    /**
     * Find object by primary key.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return JasminumNews|JasminumNews[]|mixed the result, formatted by the current formatter
     */
    protected function findPkComplex($key, $con)
    {
        // As the query uses a PK condition, no limit(1) is necessary.
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKey($key)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    }

    /**
     * Find objects by primary key
     * <code>
     * $objs = $c->findPks(array(12, 56, 832), $con);
     * </code>
     * @param     array $keys Primary keys to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return PropelObjectCollection|JasminumNews[]|mixed the list of results, formatted by the current formatter
     */
    public function findPks($keys, $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKeys($keys)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->format($stmt);
    }

    /**
     * Filter the query by primary key
     *
     * @param     mixed $key Primary key to use for the query
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function filterByPrimaryKey($key)
    {

        return $this->addUsingAlias(JasminumNewsPeer::ID, $key, Criteria::EQUAL);
    }

    /**
     * Filter the query by a list of primary keys
     *
     * @param     array $keys The list of primary key to use for the query
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function filterByPrimaryKeys($keys)
    {

        return $this->addUsingAlias(JasminumNewsPeer::ID, $keys, Criteria::IN);
    }

    /**
     * Filter the query on the Id column
     *
     * Example usage:
     * <code>
     * $query->filterById(1234); // WHERE Id = 1234
     * $query->filterById(array(12, 34)); // WHERE Id IN (12, 34)
     * $query->filterById(array('min' => 12)); // WHERE Id >= 12
     * $query->filterById(array('max' => 12)); // WHERE Id <= 12
     * </code>
     *
     * @param     mixed $id The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function filterById($id = null, $comparison = null)
    {
        if (is_array($id)) {
            $useMinMax = false;
            if (isset($id['min'])) {
                $this->addUsingAlias(JasminumNewsPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($id['max'])) {
                $this->addUsingAlias(JasminumNewsPeer::ID, $id['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(JasminumNewsPeer::ID, $id, $comparison);
    }

    /**
     * Filter the query on the Title column
     *
     * Example usage:
     * <code>
     * $query->filterByTitle('fooValue');   // WHERE Title = 'fooValue'
     * $query->filterByTitle('%fooValue%'); // WHERE Title LIKE '%fooValue%'
     * </code>
     *
     * @param     string $title The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function filterByTitle($title = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($title)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $title)) {
                $title = str_replace('*', '%', $title);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(JasminumNewsPeer::TITLE, $title, $comparison);
    }

    /**
     * Filter the query on the Body column
     *
     * Example usage:
     * <code>
     * $query->filterByBody('fooValue');   // WHERE Body = 'fooValue'
     * $query->filterByBody('%fooValue%'); // WHERE Body LIKE '%fooValue%'
     * </code>
     *
     * @param     string $body The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function filterByBody($body = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($body)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $body)) {
                $body = str_replace('*', '%', $body);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(JasminumNewsPeer::BODY, $body, $comparison);
    }

    /**
     * Filter the query on the Creation_Date column
     *
     * Example usage:
     * <code>
     * $query->filterByCreationDate('2011-03-14'); // WHERE Creation_Date = '2011-03-14'
     * $query->filterByCreationDate('now'); // WHERE Creation_Date = '2011-03-14'
     * $query->filterByCreationDate(array('max' => 'yesterday')); // WHERE Creation_Date > '2011-03-13'
     * </code>
     *
     * @param     mixed $creationDate The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function filterByCreationDate($creationDate = null, $comparison = null)
    {
        if (is_array($creationDate)) {
            $useMinMax = false;
            if (isset($creationDate['min'])) {
                $this->addUsingAlias(JasminumNewsPeer::CREATION_DATE, $creationDate['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($creationDate['max'])) {
                $this->addUsingAlias(JasminumNewsPeer::CREATION_DATE, $creationDate['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(JasminumNewsPeer::CREATION_DATE, $creationDate, $comparison);
    }

    /**
     * Filter the query on the Creation_Time column
     *
     * Example usage:
     * <code>
     * $query->filterByCreationTime('2011-03-14'); // WHERE Creation_Time = '2011-03-14'
     * $query->filterByCreationTime('now'); // WHERE Creation_Time = '2011-03-14'
     * $query->filterByCreationTime(array('max' => 'yesterday')); // WHERE Creation_Time > '2011-03-13'
     * </code>
     *
     * @param     mixed $creationTime The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function filterByCreationTime($creationTime = null, $comparison = null)
    {
        if (is_array($creationTime)) {
            $useMinMax = false;
            if (isset($creationTime['min'])) {
                $this->addUsingAlias(JasminumNewsPeer::CREATION_TIME, $creationTime['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($creationTime['max'])) {
                $this->addUsingAlias(JasminumNewsPeer::CREATION_TIME, $creationTime['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(JasminumNewsPeer::CREATION_TIME, $creationTime, $comparison);
    }

    /**
     * Filter the query on the Gotcha_Users_Id column
     *
     * Example usage:
     * <code>
     * $query->filterByGotchaUsersId(1234); // WHERE Gotcha_Users_Id = 1234
     * $query->filterByGotchaUsersId(array(12, 34)); // WHERE Gotcha_Users_Id IN (12, 34)
     * $query->filterByGotchaUsersId(array('min' => 12)); // WHERE Gotcha_Users_Id >= 12
     * $query->filterByGotchaUsersId(array('max' => 12)); // WHERE Gotcha_Users_Id <= 12
     * </code>
     *
     * @see       filterByGotchaUsers()
     *
     * @param     mixed $gotchaUsersId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function filterByGotchaUsersId($gotchaUsersId = null, $comparison = null)
    {
        if (is_array($gotchaUsersId)) {
            $useMinMax = false;
            if (isset($gotchaUsersId['min'])) {
                $this->addUsingAlias(JasminumNewsPeer::GOTCHA_USERS_ID, $gotchaUsersId['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($gotchaUsersId['max'])) {
                $this->addUsingAlias(JasminumNewsPeer::GOTCHA_USERS_ID, $gotchaUsersId['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(JasminumNewsPeer::GOTCHA_USERS_ID, $gotchaUsersId, $comparison);
    }

    /**
     * Filter the query on the Thumbnail column
     *
     * Example usage:
     * <code>
     * $query->filterByThumbnail('fooValue');   // WHERE Thumbnail = 'fooValue'
     * $query->filterByThumbnail('%fooValue%'); // WHERE Thumbnail LIKE '%fooValue%'
     * </code>
     *
     * @param     string $thumbnail The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function filterByThumbnail($thumbnail = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($thumbnail)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $thumbnail)) {
                $thumbnail = str_replace('*', '%', $thumbnail);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(JasminumNewsPeer::THUMBNAIL, $thumbnail, $comparison);
    }

    /**
     * Filter the query by a related GotchaUsers object
     *
     * @param   GotchaUsers|PropelObjectCollection $gotchaUsers The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return                 JasminumNewsQuery The current query, for fluid interface
     * @throws PropelException - if the provided filter is invalid.
     */
    public function filterByGotchaUsers($gotchaUsers, $comparison = null)
    {
        if ($gotchaUsers instanceof GotchaUsers) {
            return $this
                ->addUsingAlias(JasminumNewsPeer::GOTCHA_USERS_ID, $gotchaUsers->getId(), $comparison);
        } elseif ($gotchaUsers instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(JasminumNewsPeer::GOTCHA_USERS_ID, $gotchaUsers->toKeyValue('Id', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByGotchaUsers() only accepts arguments of type GotchaUsers or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the GotchaUsers relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function joinGotchaUsers($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('GotchaUsers');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'GotchaUsers');
        }

        return $this;
    }

    /**
     * Use the GotchaUsers relation GotchaUsers object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   \GotchaDatabase\GotchaUsersQuery A secondary query class using the current class as primary query
     */
    public function useGotchaUsersQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinGotchaUsers($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'GotchaUsers', '\GotchaDatabase\GotchaUsersQuery');
    }

    /**
     * Filter the query by a related JasminumNewsLinks object
     *
     * @param   JasminumNewsLinks|PropelObjectCollection $jasminumNewsLinks  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return                 JasminumNewsQuery The current query, for fluid interface
     * @throws PropelException - if the provided filter is invalid.
     */
    public function filterByJasminumNewsLinks($jasminumNewsLinks, $comparison = null)
    {
        if ($jasminumNewsLinks instanceof JasminumNewsLinks) {
            return $this
                ->addUsingAlias(JasminumNewsPeer::ID, $jasminumNewsLinks->getJasminumNewsId(), $comparison);
        } elseif ($jasminumNewsLinks instanceof PropelObjectCollection) {
            return $this
                ->useJasminumNewsLinksQuery()
                ->filterByPrimaryKeys($jasminumNewsLinks->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByJasminumNewsLinks() only accepts arguments of type JasminumNewsLinks or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the JasminumNewsLinks relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function joinJasminumNewsLinks($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('JasminumNewsLinks');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'JasminumNewsLinks');
        }

        return $this;
    }

    /**
     * Use the JasminumNewsLinks relation JasminumNewsLinks object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   \GotchaDatabase\JasminumNewsLinksQuery A secondary query class using the current class as primary query
     */
    public function useJasminumNewsLinksQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinJasminumNewsLinks($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'JasminumNewsLinks', '\GotchaDatabase\JasminumNewsLinksQuery');
    }

    /**
     * Exclude object from result
     *
     * @param   JasminumNews $jasminumNews Object to remove from the list of results
     *
     * @return JasminumNewsQuery The current query, for fluid interface
     */
    public function prune($jasminumNews = null)
    {
        if ($jasminumNews) {
            $this->addUsingAlias(JasminumNewsPeer::ID, $jasminumNews->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }

}
